function index(tbl){

}
function pay(tbl){

}
function app(tbl){

}
function detail(tbl){
	attr("_httpurl","vip/")
	return null;
}
function ktvip(tbl){
	var id=uuid();
	tbl.set("id",id)
	$save(tbl)
	var u=dao.fetch("users",Cnd.where("username","=",tbl.username))
	var order=new Record();
	var oid=uuid();
	order.set(".table","orders");
	order.set("id",oid);
	var OrderNo=Java.type("com.jse.util.OrderNo");
	var no=OrderNo.getOrderNo();
	var carts=new ArrayList();
	var cart=new Record();
	cart.set("table_name","vip");
	cart.set("table_id",id);
	if(tbl.price=="365"){
		cart.set("title","vip会员充值");
	}else{
		cart.set("title","超级会员充值");
	}
	cart.set("img","img/vip.jpg");
	cart.set("num",1);
	cart.set("price",tbl.price);
	carts.add(cart)
	var cartstr=Json.toJson(carts)
	order.set("carts",cartstr);
	order.set("orderno",no);
	order.set("user_id",u.id);
	order.set("price",tbl.price);
	order.set("total_price",tbl.price)
	if(tbl.type=="vip"){
		order.set("title","vip充值")
		order.set("content","vip充值")
		order.set("text","vip充值")
	}else{
		order.set("title","svip充值")
		order.set("content","svip充值")
		order.set("text","svip充值")
	}
	order.set("add_time",new java.util.Date())
	order.set("img","img/vip.jpg")
	$save(order);
	if(tbl.paytype=="wx"){
		attr("_httpurl","pay/wx_pay?order_id="+oid)
	}else if(tbl.paytype=="alipay"){
		attr("_httpurl","pay/alipay_pay?order_id="+oid)
	}else{//心币支付
		
	}
	return tbl;
}
function isusername(tbl){
	var num=dao.count("users",Cnd.where("username","=",tbl.username))
	if(num>0){
		return 1;
	}else{
		return 0;
	}
}